package com.xyy.yueshijia.presenter;

import android.util.Log;

import com.xyy.yueshijia.base.BasePresenter;
import com.xyy.yueshijia.bean.BaseBean;
import com.xyy.yueshijia.bean.shop.SpecialBean;
import com.xyy.yueshijia.bean.shop.StoreDatas;
import com.xyy.yueshijia.bean.shop.StoreGoods;
import com.xyy.yueshijia.bean.shop.StoreNews_special;
import com.xyy.yueshijia.modle.GoodsSpeciaModel;
import com.xyy.yueshijia.view.impl.GoodsSpecialView;

import java.util.List;
import java.util.Map;

import rx.Subscriber;

/**
 * Created by lxs on 2017/2/10.
 */

public class GoodsSpeciaPresenter extends BasePresenter<GoodsSpecialView> {

    protected GoodsSpeciaModel model;

    public GoodsSpeciaPresenter() {
        model = new GoodsSpeciaModel();
    }

    public void  getGoodsSpecialDatas(Map<String,String> params){
       model.getSpeciaData(params, new Subscriber<SpecialBean>() {
           @Override
           public void onCompleted() {

           }

           @Override
           public void onError(Throwable e) {
            Log.i("tag","------"+e.getMessage());
           }

           @Override
           public void onNext(SpecialBean storeDatasBaseBean) {
               int code = storeDatasBaseBean.getCode();

               mView.onSuccess(storeDatasBaseBean.getStoreDatas());
               StoreDatas datas = storeDatasBaseBean.getStoreDatas();
               String special_image = datas.getSpecial_image();

               List<StoreNews_special> storeNews_specialList = datas.getStoreNews_specialList();

               int size = storeNews_specialList.size();

               List<StoreGoods> storeGoodsList = storeNews_specialList.get(1).getStoreGoodsList();
           }
       });
    }
}
